﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Routing;

namespace WebMVC.Helpers
{
    public class HtmlHelpers
    {
        public static string AddPaging(string url, int page)
        {
            string pageParam = "?page=";
            if (url.Contains("?"))
            {
                if (url.Contains("?page="))
                {
                    pageParam = "?page=";
                }
                else
                {
                    pageParam = "&page=";
                }
                
            }
            if (url.Contains(pageParam))
            {
                url = url.Remove(url.IndexOf(pageParam));
            }
            url = url + pageParam + page;
            return url;
        }
    }
}
